<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="i1" placeholder="姓名">
<input type="text" id="i2" placeholder="工资">
<input type="text" id="i3" placeholder="工作">
<input type="button" value="添加" onclick="f()">

<table border="1">
    <tr>
        <th>姓名</th>
        <th>工资</th>
        <th>工作</th>
    </tr>
</table>
<script>
    //获取三个文本框
    // let username = document.querySelector("#i1");
    // let money = document.querySelector("#i2");
    // let work = document.querySelector("#i3");
    let table = document.querySelector("table");
    function f(){
        //创建tr和td
        let tr = document.createElement("tr")
        let name = document.createElement("td");
        let salary= document.createElement("td");
        let work = document.createElement("td");
        //把用户输入内容添加到td里面
        name.innerText = i1.value;
        salay.innerText = i2.value;
        work.innerText = i3.value;
        //把td装进tr
        tr.append(name, salary, work);
        table.append(tr);
    }
</script>

</body>
</html>